using System;
using System.Collections.Generic;

namespace LeadTracker.Models
{
	public class LeadToken
	{


		readonly int? m_LeadKey;

		readonly string m_Title;

		public LeadToken(IDictionary<string, object> fields)
		{
			CopyValue(fields, "LeadKey", ref m_LeadKey);
			CopyValue(fields, "Title", ref m_Title);
		}

		static void CopyValue<T>(IDictionary<string, object> fields, string fieldName, ref T target)
		{
			if (fields.ContainsKey(fieldName))
			{
				object fieldValue = fields[fieldName];
				if (fieldValue != null && fieldValue != DBNull.Value)
					target = (T)fieldValue;
			}
		}


		public int? PrimaryKey
		{
			get { return m_LeadKey; }
		}


		public int? LeadKey
		{
			get { return m_LeadKey; }
		}


		public string Title
		{
			get { return m_Title; }
		}




	}
}
